<?php
/**
 * Copyright (c) 2006, PORTALIER Julien
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @package    FeatherPHP
 * @subpackage Helpers
 * @copyright  Copyright (c) 2006, Julien PORTALIER
 * @link       http://feather.portalier.com
 * @license    http://www.opensource.org/licenses/mit-license.php The MIT License
 */

class JavascriptHelper
{
	function link($url)
	{
		if (strpos($url, '://') === false)
		{
			if ($url{0} != '/')
				$url = "/js/$url";
			$url = "/js.php?url=$url.js";
		}
		return '<script type="text/javascript" src="'.$url.'"></script>';
	}
	
	function inline($script)
	{
		echo <<<EndToolbarJavascript

<script type="text/javascript">
// <![CDATA[
$script
// ]]>
</script>

EndToolbarJavascript;
	}
}
?>